from __future__ import print_function
import sys
import libvirt

conn = libvirt.open('qemu:///system')
if conn is None:
    print('Failed to open connection to qemu:///system', file=sys.stderr)
    sys.exit(1)

nodeinfo = conn.getInfo()
print('Model: {0}'.format(nodeinfo[0]))
print('Memory size: {0}'.format(nodeinfo[1])+'MB')
print('Number of CPUs: {0}'.format(nodeinfo[2]))
print('MHz of CPUs: {0}'.format(nodeinfo[3]))
print('Number of NUMA nodes: {0}'.format(nodeinfo[4]))
print('Number of CPU sockets: {0}'.format(nodeinfo[5]))
print('Number of CPU cores per socket: {0}'.format(nodeinfo[6]))
print('Number of CPU threads per core: {0}'.format(nodeinfo[7]))
conn.close()

